if (!("finalizeConstruction" in ViewPU.prototype)) {
    Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
}
export class ValueView extends ViewPU {
    constructor(g16, h16, i16, j16 = -1, k16 = undefined, l16) {
        super(g16, i16, j16, l16);
        if (typeof k16 === "function") {
            this.paramsGenerator_ = k16;
        }
        this.__timeDesc = new ObservedPropertySimplePU("", this, "timeDesc");
        this.__labelDesc = new ObservedPropertySimplePU("", this, "labelDesc");
        this.__valueDesc = new ObservedPropertySimplePU("", this, "valueDesc");
        this.__unitDesc = new SynchedPropertySimpleTwoWayPU(h16.unitDesc, this, "unitDesc");
        this.__dataSource = new SynchedPropertyObjectTwoWayPU(h16.dataSource, this, "dataSource");
        this.__index = new SynchedPropertySimpleTwoWayPU(h16.index, this, "index");
        this.__curTimeStamp = this.initializeConsume("curTimeStamp", "curTimeStamp");
        this.setInitiallyProvidedValue(h16);
        this.declareWatch("dataSource", this.refresh);
        this.declareWatch("index", this.refresh);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(f16) {
        if (f16.timeDesc !== undefined) {
            this.timeDesc = f16.timeDesc;
        }
        if (f16.labelDesc !== undefined) {
            this.labelDesc = f16.labelDesc;
        }
        if (f16.valueDesc !== undefined) {
            this.valueDesc = f16.valueDesc;
        }
    }
    updateStateVars(e16) {
    }
    purgeVariableDependenciesOnElmtId(d16) {
        this.__timeDesc.purgeDependencyOnElmtId(d16);
        this.__labelDesc.purgeDependencyOnElmtId(d16);
        this.__valueDesc.purgeDependencyOnElmtId(d16);
        this.__unitDesc.purgeDependencyOnElmtId(d16);
        this.__dataSource.purgeDependencyOnElmtId(d16);
        this.__index.purgeDependencyOnElmtId(d16);
        this.__curTimeStamp.purgeDependencyOnElmtId(d16);
    }
    aboutToBeDeleted() {
        this.__timeDesc.aboutToBeDeleted();
        this.__labelDesc.aboutToBeDeleted();
        this.__valueDesc.aboutToBeDeleted();
        this.__unitDesc.aboutToBeDeleted();
        this.__dataSource.aboutToBeDeleted();
        this.__index.aboutToBeDeleted();
        this.__curTimeStamp.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get timeDesc() {
        return this.__timeDesc.get();
    }
    set timeDesc(c16) {
        this.__timeDesc.set(c16);
    }
    get labelDesc() {
        return this.__labelDesc.get();
    }
    set labelDesc(b16) {
        this.__labelDesc.set(b16);
    }
    get valueDesc() {
        return this.__valueDesc.get();
    }
    set valueDesc(a16) {
        this.__valueDesc.set(a16);
    }
    get unitDesc() {
        return this.__unitDesc.get();
    }
    set unitDesc(z15) {
        this.__unitDesc.set(z15);
    }
    get dataSource() {
        return this.__dataSource.get();
    }
    set dataSource(y15) {
        this.__dataSource.set(y15);
    }
    get index() {
        return this.__index.get();
    }
    set index(x15) {
        this.__index.set(x15);
    }
    get curTimeStamp() {
        return this.__curTimeStamp.get();
    }
    set curTimeStamp(w15) {
        this.__curTimeStamp.set(w15);
    }
    refresh() {
        this.timeDesc = this.dataSource.xAlias[this.index];
        this.labelDesc = this.dataSource.xLabel ? this.dataSource.xLabel[this.index] : '';
        const p15 = this.timeDesc.match(/(\d{4})年(\d{2})月(\d{2})日/);
        if (p15) {
            const v15 = `${p15[1]}-${p15[2]}-${p15[3]}`;
            this.curTimeStamp = new Date(v15).getTime();
        }
        else {
            console.log("日期格式不正确");
        }
        let q15 = "";
        this.dataSource.yAxis.forEach((s15, t15) => {
            const u15 = s15.getDrawPoints()[this.index]
                .value;
            if (u15 <= 0) {
                q15 += "--/";
            }
            else {
                q15 += s15.getDrawPoints()[this.index]
                    .value + "/";
            }
        });
        q15 = q15.substring(0, q15.length - 1);
        this.valueDesc = q15;
    }
    initialRender() {
        this.observeComponentCreation2((n15, o15) => {
            Column.create();
            Column.margin({ top: 5 });
        }, Column);
        this.observeComponentCreation2((l15, m15) => {
            Text.create(this.timeDesc);
            Text.fontSize(13);
            Text.fontColor('#999999');
        }, Text);
        Text.pop();
        this.observeComponentCreation2((j15, k15) => {
            RelativeContainer.create();
            RelativeContainer.width('100%');
            RelativeContainer.height(36);
        }, RelativeContainer);
        this.observeComponentCreation2((h15, i15) => {
            Text.create(this.labelDesc);
            Text.id("text0");
            Text.fontSize(13);
            Text.fontColor('#191919');
            Text.fontWeight(FontWeight.Bold);
            Text.alignRules({
                bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
                right: { anchor: "text1", align: HorizontalAlign.Start }
            });
            Text.margin({ right: 9 });
        }, Text);
        Text.pop();
        this.observeComponentCreation2((f15, g15) => {
            Text.create(this.valueDesc);
            Text.id("text1");
            Text.fontSize(26);
            Text.fontColor('#191919');
            Text.fontWeight(FontWeight.Bold);
            Text.alignRules({
                center: { anchor: "__container__", align: VerticalAlign.Center },
                middle: { anchor: "__container__", align: HorizontalAlign.Center }
            });
        }, Text);
        Text.pop();
        this.observeComponentCreation2((d15, e15) => {
            Text.create(this.unitDesc);
            Text.id("text2");
            Text.fontSize(13);
            Text.fontColor('#191919');
            Text.fontWeight(FontWeight.Bold);
            Text.alignRules({
                bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
                left: { anchor: "text1", align: HorizontalAlign.End }
            });
            Text.margin({ left: 4 });
        }, Text);
        Text.pop();
        RelativeContainer.pop();
        Column.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
